﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace 生命体征测试仪
{
    public partial class formUserPhoneNum : formBase
    {
        public formUserPhoneNum()
        {
            InitializeComponent();
            numKey1.NumKey_BtnClicked += new 生命体征测试仪.NumKey.BtnClickHandle(InputNum);            
        }
        public string phoneNum="";
        private void skinButton2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        
        private void skinButton1_Click(object sender, EventArgs e)
        {
            Regex regex = new Regex("^1\\d{10}$");
            if (!regex.IsMatch(tbPhone.Text)) 
            {
                MessageBox.Show("你输入的手机号有误");
                return;
            }
            phoneNum = tbPhone.Text;
            this.Close();
        }
        void InputNum(int n)
        {
            this.Invoke((EventHandler)(delegate
            {
                if (n == -1)
                    tbPhone.Text = "";
                else if (n == -2)
                    tbPhone.Text = tbPhone.Text.Substring(0, tbPhone.Text.Length - 1);
                else
                    tbPhone.AppendText(n.ToString());
            }));
        }
    }
}
